package com.example;


import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class Main {

    public static void main(String[] args) {
        //创建Schema对象
        //构造方法第一个参数为数据库版本号,第二个参数为自动生成的实体类想要存放的位置
        Schema schema = new Schema(1000, "com.wcl.demo.model.entity");
        addNode(schema);


        try {
            //创建实体类 第二个参数填的是android model的路径
            new DaoGenerator().generateAll(schema, "./app/src/main/java");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /***
     * 添加将要创建的实体类信息,会根据类名生成数据库的表名,属性名生成数据库的字段<p>
     * 有多少个实体类就需要写多少个表
     *
     * @param schema
     */
    private static void addNode(Schema schema) {
        //指定需要生成实体类的类名,类名确定了之后表名也根据这个类名来自动命名
        /***用户表***/
        Entity entity = schema.addEntity("User");
        entity.addLongProperty("msg_id").primaryKey().autoincrement();
        entity.addStringProperty("username");//用户名
        entity.addStringProperty("nick");//用户昵称
        entity.addStringProperty("avatar");//用户头像


        Entity entity2 = schema.addEntity("Mp3Info");
        entity2.addLongProperty("msg_id").primaryKey().autoincrement();
        entity2.addLongProperty("id");
        entity2.addStringProperty("title");
        entity2.addStringProperty("album");
        entity2.addLongProperty("albumId");
        entity2.addStringProperty("displayName");
        entity2.addStringProperty("artist");
        entity2.addLongProperty("duration");
        entity2.addLongProperty("size");
        entity2.addStringProperty("url");
        entity2.addStringProperty("lrcTitle");
        entity2.addStringProperty("lrcSize");


        Entity entity_info = schema.addEntity("UserInfor");
        entity_info.addLongProperty("msg_id_info").primaryKey().autoincrement();
        entity_info.addStringProperty("user_person");
        entity_info.addStringProperty("user_work");
        entity_info.addStringProperty("user_school");
        entity_info.addStringProperty("user_birthday");
        entity_info.addStringProperty("user_parent_area");
        entity_info.addStringProperty("user_phone");
        entity_info.addStringProperty("username");


        Entity entity_messages = schema.addEntity("InviteMessages");
        entity_messages.addLongProperty("msg_id_message").primaryKey().autoincrement();
        entity_messages.addStringProperty("id");
        entity_messages.addStringProperty("username");
        entity_messages.addStringProperty("groupid");
        entity_messages.addStringProperty("groupname");
        entity_messages.addStringProperty("time");
        entity_messages.addStringProperty("reason");
        entity_messages.addStringProperty("status");
        entity_messages.addStringProperty("isInviteFromMe");
        entity_messages.addStringProperty("unreadMsgCount");

        Entity entity_message = schema.addEntity("InviteMessage");
        entity_message.addLongProperty("msg_id_message").primaryKey().autoincrement();
        entity_message.addStringProperty("from");
        entity_message.addStringProperty("groupname");
        entity_message.addLongProperty("time");
        entity_message.addStringProperty("groupid");
        entity_message.addStringProperty("reason");
        entity_message.addIntProperty("status");


        Entity note_message = schema.addEntity("AroundInfor");
        note_message.addLongProperty("around_id_message").primaryKey().autoincrement();
        note_message.addIntProperty("month");
        note_message.addIntProperty("date");
        note_message.addStringProperty("note");
        note_message.addStringProperty("pictureKey");


        Entity bg_entity = schema.addEntity("BackGroundData");
        bg_entity.addLongProperty("bg_id_message").primaryKey().autoincrement();
        bg_entity.addStringProperty("pictureKey");

        Entity note_bg_entity=schema.addEntity("NoteBgData");
        note_bg_entity.addLongProperty("note_bg_message").primaryKey().autoincrement();
        note_bg_entity.addStringProperty("pictureKey");

        Entity private_entity=schema.addEntity("CanSendData");
        private_entity.addLongProperty("private_message_id").primaryKey().autoincrement();
        private_entity.addStringProperty("canSend");

        Entity vip_entity=schema.addEntity("VIPLevel");
        vip_entity.addLongProperty("vip_Id").primaryKey().autoincrement();
        vip_entity.addIntProperty("vip_level");



    }


}
